package easier.tools;

import java.io.File;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public class MyClass {

    public static void main( String[] args ) {

        long a = 18306;
        long hour = a / 60 / 60;
        long minutes = (a - (hour * 60 * 60)) / 60;
        long seconds = (a - (hour * 60 * 60) - minutes * 60);
        String result = String.format( "%d:%02d:%02d", hour, minutes, seconds );
        System.out.println( result );
    }

    public static void a1( String path ) {

        File file = new File( path );
        if ( file.isDirectory() ) {
            File[] files = file.listFiles();
            for ( File f : files ) {
                String name = f.getName();
                System.out.println( "原始文件" + name );
                if ( name.contains( ".pdf" ) ) {
                    File dest = new File( f.getParentFile(), name.replace( ".pdf", "" ) );
                    f.renameTo( dest );
                    System.out.println( "目标文件" + dest );
                }
                if ( name.contains( ".PDF" ) ) {
                    File dest = new File( f.getParentFile(), name.replace( ".PDF", "" ) );
                    f.renameTo( dest );
                    System.out.println( "目标文件" + dest );
                }
            }
        }
    }

    public static class Data {

        public int flag;
        public String result;

        @Override
        public String toString() {

            return "Data{" +
                "flag=" + flag +
                ", result='" + result + '\'' +
                '}';
        }
    }

    public static class CodeMsgData< T > {

        public int code;
        public String message;
        public T data;

        @Override
        public String toString() {

            return "CodeMsgData{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
        }
    }

    public static class ParameterizedTypeImpl implements ParameterizedType {

        private final Class raw;
        private final Type[] args;

        public ParameterizedTypeImpl( Class raw, Type[] args ) {

            this.raw = raw;
            this.args = args != null ? args : new Type[0];
        }

        @Override
        public Type[] getActualTypeArguments() {

            return args;
        }

        @Override
        public Type getRawType() {

            return raw;
        }

        @Override
        public Type getOwnerType() {return null;}
    }
}